
<%@taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@taglib uri="http://richfaces.org/rich" prefix="rich"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <LINK rel="stylesheet" type="text/css" href="commun_styles.css"/>
            <title>Interventions</title>
        </head>
        <body>
            <h:form id="formintervention">
                <a4j:include viewId="entete.jsp"/>
                <a4j:include viewId="menu.jsp"/>
                <rich:spacer height="50px"/>
                <h:inputHidden value="#{InterventionsBean.init}"/>
                <center>
                    <rich:tabPanel style="width:500px;">
                        <rich:tab label="Intervention">
                            <h:panelGrid width="450px" columns="1">
                                <h:outputText id="infomsg" value="#{InterventionsBean.message}" styleClass="#{InterventionsBean.style_message}"/>
                                <rich:panel id="tablepanel" header="Liste Interventions">
                                    <rich:dataTable
                                    onRowMouseOver="this.style.backgroundColor='#B5CEFD'" binding="#{InterventionsBean.dataTable}"
                                        onRowMouseOut="this.style.backgroundColor='#{org.richfaces.SKIN.tableBackgroundColor}'"
                                        onRowClick="this.style.backgroundColor='#F1F1F1'"
                                        rows="8" width="100%" id="tbl" value="#{InterventionsBean.interv_list}" var="interv">
                                    <rich:column>
                                        <f:facet name="header">
                                            <h:outputText value="Equipement"/>
                                        </f:facet>
                                        <h:outputText value="#{interv.equipement.eqLib}"/>
                                    </rich:column>
                                    <rich:column>
                                        <f:facet name="header">
                                            <h:outputText value="Intervenant"/>
                                        </f:facet>
                                        <h:outputText value="#{interv.personnel.persNom} #{interv.personnel.persPrenom}"/>
                                    </rich:column>
                                    <rich:column>
                                        <f:facet name="header">
                                            <h:outputText value="Date"/>
                                        </f:facet>
                                        <h:outputText value="#{interv.intervDate}">
                                            <f:convertDateTime pattern="dd/MM/yyyy"/>
                                        </h:outputText>
                                    </rich:column>
                                    <rich:column style="text-align:center" width="70px">
                                        <f:facet name="header">
                                            <h:outputText value="Modifier"/>
                                        </f:facet>
                                        <a4j:commandLink action="#{InterventionsBean.modifierLigne}" reRender="infomsg,tablepanel,panelinfo,crud_panel" >
                                            <h:graphicImage style="border:0" url="/images/Modify.gif" />
                                        </a4j:commandLink>
                                    </rich:column>
                                    <rich:column style="text-align:center" width="70px">
                                        <f:facet name="header">
                                            <h:outputText value="Supprimer"/>
                                        </f:facet>
                                        <a4j:commandLink action="#{InterventionsBean.supprimer}" ajaxSingle="true" reRender="infomsg,tablepanel,panelinfo,crud_panel">
                                            <h:graphicImage style="border:0" url="/images/Delete.gif"/>
                                        </a4j:commandLink>
                                    </rich:column>
                                    <f:facet name="footer">
                                        <rich:datascroller/>
                                    </f:facet>
                                    </rich:dataTable>
                                </rich:panel>
                                <rich:panel id="panelinfo" header="Information generales">
                                    <h:panelGrid columns="2" width="350">
                                        <h:outputText value="Equipement : "/>
                                        <rich:comboBox id="eqpinterv" defaultLabel="Entrez une valeur" value="#{InterventionsBean.current_equipement}" required="true"
                                        disabled="#{InterventionsBean.etat}" suggestionValues="#{InterventionsBean.equip_list}">
                                        </rich:comboBox>
                                        <h:outputText value="Intervenant : "/>
                                        <rich:comboBox id="persinterv" defaultLabel="Entrez une valeur" value="#{InterventionsBean.current_personnel}" required="true"
                                        disabled="#{InterventionsBean.etat}" suggestionValues="#{InterventionsBean.person_list}">
                                        </rich:comboBox>
                                        <h:outputText value="Date intervention : "/>
                                        <rich:calendar id="foFiscal" value="#{InterventionsBean.interv.intervDate}" popup="true" datePattern="dd/MM/yyyy"
                                        cellWidth="24px" cellHeight="22px" disabled="#{InterventionsBean.etat}" />
                                    </h:panelGrid>
                                </rich:panel>
                            </h:panelGrid>
                            <h:panelGrid id="crud_panel" columns="5">
                                <a4j:commandButton id="nouvinterv" value="Nouveau" style="width:85px" ajaxSingle="true"
                                                    disabled="#{InterventionsBean.invetat}" action="#{InterventionsBean.viderChamps}" reRender="infomsg,tablepanel,panelinfo,crud_panel" />
                                <a4j:commandButton id="modifinterv" value="Modifier" style="width:85px" ajaxSingle="true"
                                                    disabled="#{InterventionsBean.invetat}" action="#{InterventionsBean.modifier}" reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
                                <a4j:commandButton id="suppinterv" value="Supprimer" style="width:85px" ajaxSingle="true"
                                                    disabled="#{InterventionsBean.invetat}" action="#{InterventionsBean.supprimer}" reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
                                <a4j:commandButton id="validinterv" value="Valider" style="width:85px" ajaxSingle="true"
                                                    disabled="#{InterventionsBean.etat}" action="#{InterventionsBean.create}" reRender="infomsg,tablepanel,panelinfo,crud_panel" />
                                <a4j:commandButton id="annulinterv" value="Annuler" style="width:85px" ajaxSingle="true"
                                                    disabled="#{InterventionsBean.etat}" action="#{InterventionsBean.annuler}" reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
                            </h:panelGrid>
                        </rich:tab>
                    </rich:tabPanel>
                </center>
            </h:form>
        </body>
    </html>
</f:view>